﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DeviceModule.Services
{
    /// <summary>
    /// 注册解析器
    /// </summary>
    public class DeviceParserRegistry : IDeviceParserRegistry
    {
        private readonly Dictionary<string, IDeviceParser> _parsers = new();

        public void Register(string model, IDeviceParser parser)
        {
            _parsers[model] = parser;
        }

        public IDeviceParser GetParser(string model)
        {
            return _parsers.TryGetValue(model, out var parser) ? parser : null;
        }
    }
}
